package pe.edu.upc.dsd.rs;


import java.io.BufferedReader;
import java.io.InputStreamReader;

import junit.framework.Assert;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.Test;


public class RestPruebasUnitariasSoundTracks {
	@Test	
	
	public void prueba() throws Exception {
		HttpClient httpclient = new  DefaultHttpClient();
		
		HttpGet httpget = new HttpGet("http://localhost:8080/rs-server-consolida/rest/soundtrack/01-01-2011" );
		
									   
		
		HttpResponse response = httpclient.execute(httpget);		
		HttpEntity entity = response.getEntity();		
		BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));		
		String  jsontext =reader.readLine();	
		
		// pinta en el log del servidor
		System.out.println(jsontext );
		
		Assert.assertEquals(true,  jsontext.length() > 0 );		
	}	
}